Renaming functionality for Filter-presets#4861
Conversation
ef6bb2a to
69b6af3
Compare
gulyasgergely902
left a comment
There was a problem hiding this comment.
Only left some minor questions / issues.
| if not name or not name.strip(): | ||
| raise codechecker_api_shared.ttypes.RequestFailed( | ||
| codechecker_api_shared.ttypes.ErrorCode.DATABASE, | ||
| "Preset name cannot be empty!") |
There was a problem hiding this comment.
Either use "xyz cannot be empty" or "Invalid xyz" but choose one and stick with it. I'd use "Preset name cannot be empty" and "Preset ID cannot be empty" since this error is thrown because a required argument was left out and so it cannot be invalid if it is empty.
| if not preset_id: | ||
| raise codechecker_api_shared.ttypes.RequestFailed( | ||
| codechecker_api_shared.ttypes.ErrorCode.DATABASE, | ||
| "Invalid preset ID!") |
There was a problem hiding this comment.
Please, add an empty line between validation and the actual query of the filter preset for better readability.
| def renameFilterPreset(self, preset_id: int, name: str): | ||
| """ | ||
| Rename a filter preset. | ||
| Returns the ID of the renamed preset. |
There was a problem hiding this comment.
Since you are supplying the preset_id which you want to rename, it is not much information to return it at the end too. I'd return a success instead like a 0 and raise (as currently implemented) if there was any error during. What was the motivation behind returning the preset_id?
| color="primary" | ||
| :disabled="!presetName" | ||
| @click="saveCurrentFilter(saveMode)" | ||
| @click="saveMode !== 'rename' |
There was a problem hiding this comment.
I'd move this logic to the function "saveCurrentFilter()" instead. Also it could be renamed to savePreset and it could handle saving and renaming too.
This pull request adds the ability to rename filter presets throughout the CodeChecker system. It introduces a new backend API for renaming presets, updates the command-line interface and web UI to support this feature, and provides comprehensive tests for the new functionality. Additionally, the API and client versions are bumped to 6.71.0.
Rename filter preset feature:
renameFilterPresetRPC method to thecodeCheckerDBAccessThrift service, allowing filter presets to be renamed by ID. The method validates the new name, checks for duplicate names, and ensures the preset exists.renameFilterPresetmethod in the Python client and added a corresponding CLI command (filter-preset rename) with arguments for preset ID and new name.Testing improvements:
Version bumps: